<?

class API_action {
	private $url = "http://w3monitor.com/_utilities/api_user.php";

	public function __construct($aAction){
		$this->action = $aAction;
	}
	
	public function UserCheckLogin ($login,$pass) {
		if ($this->action!="login") exit("Incorrect Action");

		if ($ch = curl_init())  {
			 curl_setopt($ch, CURLOPT_URL, $this->url);
			 curl_setopt($ch, CURLOPT_HEADER, false);
			 curl_setopt($ch, CURLOPT_POST, 1);
			 curl_setopt($ch, CURLOPT_POSTFIELDS, "action=".$this->action."&f_login_email=".$login."&f_login_password=".$pass);
			 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
			 //@curl_setopt($ch, CURLOPT_USERAGENT, 'PHP Bot');
			 $data = @curl_exec($ch);
			 curl_close($ch);
			 echo "<br>".$data;
		} else {
			return false;
		}
	}

//-------------------------------------------------------------------------------------------------------------------------------------------------	


	public function UserSignUp ($name,$email,$pass) {
		if ($this->action!="signup") exit("Incorrect Action");

		if ($ch = curl_init())  {
			 curl_setopt($ch, CURLOPT_URL, $this->url);
			 curl_setopt($ch, CURLOPT_HEADER, false);
			 curl_setopt($ch, CURLOPT_POST, 1);
			 curl_setopt($ch, CURLOPT_POSTFIELDS, "action=".$this->action."&f_first_name=".$name."&f_email=".$email."&f_password=".$pass."&f_password2=".$pass);
			 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
			 //@curl_setopt($ch, CURLOPT_USERAGENT, 'PHP Bot');
			 $data = @curl_exec($ch);
			 curl_close($ch);
			 echo "<br>".$data;
		} else {
			return false;
		}
	}
	
}


/*
SAMPLE:
Place w3m_connector.php in the website root and insert code below anywhere you need

//------------------------------------------------------------------------------
require_once("/w3m_connector.php");

$api = new API_action("signup");	
$api->UserSignUp("UserName","oggg@cid.kiev.ua","11111");

$api = new API_action("login");	
$api->UserCheckLogin("og@cid.kiev.ua","11111");

*/



?>